package br.com.extrajudicial.models;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.validator.Min;
import org.hibernate.validator.NotNull;

@Entity
@Table(name="items_orders")
public class ItemOrder implements Serializable {

	private static final long serialVersionUID = 6695845320265604305L;
	
	@Id
	@GeneratedValue
	private Long id;
	@NotNull @Column(name="item_number")
	private Integer itemNumber;
	@NotNull
	@Min(0)
	private Short quantity;
	private String info;
	
	@JoinColumn (name = "item_id", referencedColumnName = "id")
	@ManyToOne (optional = false) 
	private Item item;
	
	@JoinColumn (name = "order_id", referencedColumnName = "id")
	@ManyToOne (optional = false)
	private Order order;

	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public Integer getItemNumber() {
		return itemNumber;
	}
	public void setItemNumber(Integer itemNumber) {
		this.itemNumber = itemNumber;
	}
	public Short getQuantity() {
		return quantity;
	}
	public void setQuantity(Short quantity) {
		this.quantity = quantity;
	}
	public String getInfo() {
		return info;
	}
	public void setInfo(String info) {
		this.info = info;
	}
	public Item getItem() {
		return item;
	}
	public void setItem(Item item) {
		this.item = item;
	}
	public Order getOrder() {
		return order;
	}
	public void setOrder(Order order) {
		this.order = order;
	}

}
